<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>v-once指令</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id ="app"> 
    <h2> {{ message }} </h2>
    <!-- 首次加载该message，后面message动态变化，该值不变 -->
    <h2 v-once> {{ message }} </h2>
    <!-- 点击改变值按钮，上面第一个动态改变，上面第二个的仍为第一次的值 -->
    <button @click="change"> 改变值</button>
  </div>

  <script>
   var vm = new Vue({
    el: '#app',
    data: {
      message: "你好啊",
    },
    methods: {
      change() {
        this.message = "今天天气不错啊！";
      }
    }
   });
  </script>
</body>

</html>